/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package simple;

import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.io.Serializable;
import javax.persistence.*;

/**
 *
 * @author Jinhui
 */
@Entity
@Table(name = "casestudy", catalog = "world", schema = "")
@NamedQueries(
{
  @NamedQuery(name = "Casestudy.findAll", query = "SELECT c FROM Casestudy c"),
  @NamedQuery(name = "Casestudy.findByName", query = "SELECT c FROM Casestudy c WHERE c.name = :name"),
  @NamedQuery(name = "Casestudy.findByCity", query = "SELECT c FROM Casestudy c WHERE c.city = :city"),
  @NamedQuery(name = "Casestudy.findByCountry", query = "SELECT c FROM Casestudy c WHERE c.country = :country")
})
public class Casestudy implements Serializable
{
  @Transient
  private PropertyChangeSupport changeSupport = new PropertyChangeSupport(this);
  private static final long serialVersionUID = 1L;
  @Id
  @Basic(optional = false)
  @Column(name = "Name")
  private String name;
  @Column(name = "City")
  private String city;
  @Column(name = "Country")
  private String country;

  public Casestudy()
  {
  }

  public Casestudy(String name)
  {
    this.name = name;
  }

  public String getName()
  {
    return name;
  }

  public void setName(String name)
  {
    String oldName = this.name;
    this.name = name;
    changeSupport.firePropertyChange("name", oldName, name);
  }

  public String getCity()
  {
    return city;
  }

  public void setCity(String city)
  {
    String oldCity = this.city;
    this.city = city;
    changeSupport.firePropertyChange("city", oldCity, city);
  }

  public String getCountry()
  {
    return country;
  }

  public void setCountry(String country)
  {
    String oldCountry = this.country;
    this.country = country;
    changeSupport.firePropertyChange("country", oldCountry, country);
  }

  @Override
  public int hashCode()
  {
    int hash = 0;
    hash += (name != null ? name.hashCode() : 0);
    return hash;
  }

  @Override
  public boolean equals(Object object)
  {
    // TODO: Warning - this method won't work in the case the id fields are not set
    if (!(object instanceof Casestudy))
    {
      return false;
    }
    Casestudy other = (Casestudy) object;
    if ((this.name == null && other.name != null) || (this.name != null && !this.name.equals(other.name)))
    {
      return false;
    }
    return true;
  }

  @Override
  public String toString()
  {
    return "simple.Casestudy[ name=" + name + " ]";
  }

  public void addPropertyChangeListener(PropertyChangeListener listener)
  {
    changeSupport.addPropertyChangeListener(listener);
  }

  public void removePropertyChangeListener(PropertyChangeListener listener)
  {
    changeSupport.removePropertyChangeListener(listener);
  }

}
